﻿//-----------------------------------------------------------------------
// <copyright>
// This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
// </copyright>
//----------------------------------------------------------------------- 
using System.Xml;

namespace Fulcrum.ControlGenerator
{
    /// <summary>
    /// Holds information about a given template part.
    /// </summary>
    class RoutedCommandXmlConfiguration : IRoutedCommandBindingConfiguration
    {
        public RoutedCommandXmlConfiguration(IControlConfiguration controlConfig, XmlReader xmlReader)
        {
            // TODO Name can never be null or empty
            // TODO Summary can be null or empty but need to standardize
            this.Name = xmlReader.GetAttribute("name");
            this.Summary = xmlReader.GetAttribute("summary");
            this.CanExecuteAlways = XmlReaderHelp.GetOptionalBoolAttributeValue(xmlReader, "canExecuteAlways", true);

            this.OwningType = controlConfig.Name;

            xmlReader.Read();
        }

        public string Name
        {
            get;
            private set;
        }

        public string OwningType
        {
            get;
            private set;
        }

        public string Summary
        {
            get;
            private set;
        }

        public bool CanExecuteAlways
        {
            get;
            private set;
        }
    }
}
